Skip to content

Conversation

juj
Copy link
Collaborator

@juj juj commented Sep 22, 2025

Optimize code size in MINIMAL_RUNTIME: not all users want to override INITIAL_MEMORY via Module.

#if MINIMAL_RUNTIME
var INITIAL_MEMORY = {{{ INITIAL_MEMORY }}};
#else
var INITIAL_MEMORY = {{{ makeModuleReceiveExpr('INITIAL_MEMORY', INITIAL_MEMORY) }}};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The makeModuleReceiveExpr macro already takes care of this I think.

IIRC, MINIMAL_RUNTIME sets INCOMING_MODULE_JS_API to empty by default which should make this expand to just INITIAL_MEMORY

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this does not happen by default, but testing this now, indeed if I manually set -sINCOMING_MODULE_JS_API=[], then this does happen. So that's good solution for this, closing this PR.

@juj juj closed this Oct 1, 2025
@sbc100
Copy link
Collaborator

sbc100 commented Oct 1, 2025

Should we default INCOMING_MODULE_JS_API to empty under MINIMAL_RUNTIME like we do already in STRICT mode? See limit_incoming_module_api in link.py.

@juj
Copy link
Collaborator Author

juj commented Oct 1, 2025

Yeah, I think that would probably work out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants